<template>
	<view style="background-color: #fff; padding: 20rpx 40rpx;padding-bottom: 100rpx;">
		<u--form :borderBottom="true" labelPosition="top" :model="form" ref="uForm">
			<u-form-item labelWidth="200" label="支付宝账号">
				<u-input  border="none" v-model="form.alipay_number" placeholder="请输入支付宝账号" />
			</u-form-item>
		</u--form>
		<view style="margin-top: 90rpx;">
			<u-button @click="updateZfbNumber()" shape="circle" color="linear-gradient(to left, #e44e15, #f4aa56)">绑定支付宝</u-button>
		</view>
	</view>
</template>

<script>
	import {updateInfo} from '@/common/user.api.js'
	export default {
		data() {
			return {
				form: {
					alipay_number: ''
				},
			}
		},
		onLoad({alipay_number}) {
			this.form.alipay_number = alipay_number
		},
		methods: {
			updateZfbNumber() {
				let that = this;
				uni.showLoading({
					title: '正在绑定支付宝信息'
				})
				updateInfo({
					alipay_number: that.form.alipay_number
				}).then(res => {
					uni.hideLoading()
					that.$u.toast('绑定成功');
					that.$u.route({
						type: 'navigateBack',
					})
				})
			}
		}
	}
</script>

<style>
	body {
		background-color: #f5f5f5;
	}
</style>
